//
//  VariableViewController.swift
//  testRxSwift
//
//  Created by 火星人 on 2017/7/25.
//  Copyright © 2017年 火星人. All rights reserved.
//

import UIKit
import RxSwift

class VariableViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.addTapWithHandle { (tap) in
            
            let disBag = DisposeBag()
            
            let variable = Variable<String>("this is default value")
            
            variable.asObservable().subscribe({ (eve) in
                print("1 \(eve)")
            }).disposed(by: disBag)
            
            variable.value = "11"
            variable.value = "12"
            
            
            variable.asObservable().subscribe({ (eve) in
                print("2 \(eve)")
            }).disposed(by: disBag)
            
            variable.value = "21"
            variable.value = "22"
        }
    }
}
